<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>商品详情页</title>
    <style>
      div {
        width: 100%;
        height: 500px;
        margin: 0 auto;
        border: 2px solid #ccc;
      }
      img {
        display: block;
      }
      .wrap {
        display: flex;
        justify-content: center;
        align-items: space-evenly;
      }
      .wrap > div {
        display: flex;
        flex-direction: column;
        justify-content: space-evenly;
        align-items: center;
      }
      .wrap > div > p {
        width: 300px;
        height: 30px;
        font-weight: 20px;
      }
      .wrap > div > p:nth-of-type(3) {
        display: flex;
        justify-content: space-evenly;
        align-items: center;
      }
      .wrap > div > p:nth-of-type(3) > span {
        width: 30px;
        height: 30px;
        font-size: 30px;
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: #ccc;
        cursor: pointer;
      }
      .wrap > div > input {
        width: 300px;
        height: 50px;
        font-size: 20px;
        font-weight: bold;
        color: #fff;
        background-color: red;
        cursor: pointer;
      }
    </style>
  </head>
  <body>
    <div class="wrap">
      <!-- <img src="../shoppingCart/img/cream.jpg" />
      <div>
        <p>名称</p>
        <p>价格</p>
        <p>
          <span>-</span><input type="number" class="num" /><span class=""
            >+</span
          >
        </p>
        <input type="button" value="加入购物车" />
      </div> -->
    </div>
  </body>
  <script>
    let wrap = document.querySelector(".wrap");
    let html = "";
    function showDetials(data_id) {
      let arr = JSON.parse(localStorage.getItem("Datas"));
      let detial_obj = arr.fond(function (data_id) {
        return arr.id == data_id;
      });
      for (let i in detial_obj) {
        html += `<img src="${detial_obj.img}" />
      <div>
        <p>${detial_obj.name}</p>
        <p>${detial_obj.price}</p>
        <p>
          <span>-</span><input type="number" class="num" /><span class="">+</span>
        </p>
        <input type="button" value="加入购物车" />
      </div>`;
      }
      wrap.innerHTML = html;
    }
    show();
  </script>
</html>
